#include <iostream>
#include <cstring>
#include <queue>

using namespace std;

typedef pair<int, int> PII;

const int N = 410;

int dist[N][N];
int n, m, x, y;

int dx[] = {1, 2, 2, 1, -1, -2, -2, -1};
int dy[] = {2, 1, -1, -2, 2, 1, -1, -2};

void bfs()
{
	memset(dist, -1, sizeof dist);

	queue<PII> q;
	q.push({x, y});
	dist[x][y] = 0; // 表示已经遍历过

	while(q.size())
	{
		auto t = q.front(); q.pop();
		int i = t.first, j = t.second;

		for(int k = 0; k < 8; k++)
		{
			int x = i + dx[k], y = j + dy[k];
			if(x < 1 || x > n || y < 1 || y > m) continue;
			if(dist[x][y] != -1) continue;
			
			dist[x][y] = dist[i][j] + 1; // 更新结果
			q.push({x, y});
		}
	}
}

int main()
{
	cin >> n >> m >> x >> y;

	bfs();

	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= m; j++)
		{
			cout << dist[i][j] << " ";
		}
		cout << endl;
	}

	return 0;
}